package com.example.yixueban.service;

import com.example.yixueban.domain.Teacher;
import com.example.yixueban.domain.TeacherExample;
import com.example.yixueban.mapper.TeacherMapper;
import com.example.yixueban.req.user.SelectTeacher_Req;
import com.example.yixueban.service_interface.TeacherService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * User: Wang YiHan
 * Date: 2021/8/9 20:11
 * Email: 783096044@qq.com
 * File_Name: TeacherServiceImpl
**/
@Service
public class TeacherServiceImpl implements TeacherService{

    @Resource
    private TeacherMapper teacherMapper;


    @Override
    public List<Teacher> selectSuchTeacher(SelectTeacher_Req selectTeacher_Req) {
        String data = selectTeacher_Req.getInputData();
        List<Teacher> teacherList  =new ArrayList<>();
        /*TeacherExample teacherExample = new TeacherExample();
        TeacherExample.Criteria criteria = teacherExample.createCriteria();*/
      /*  if (!ObjectUtils.isEmpty(data)){ //如果输入的数据不为空
//            criteria.andTeacherNameLike("%"+data+"%");
            teacherMapper.selectByOneInfo(data);
        }*/
      //  List<Teacher> teacherList  =teacherMapper.selectByExample(teacherExample);
        teacherMapper.selectByOneInfo(data);
        return teacherList;
    }

    @Override
    public long countByExample(TeacherExample example) {
        return teacherMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(TeacherExample example) {
        return teacherMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(Integer teacherId) {
        return teacherMapper.deleteByPrimaryKey(teacherId);
    }

    @Override
    public int insert(Teacher record) {
        return teacherMapper.insert(record);
    }

    @Override
    public int insertSelective(Teacher record) {
        return teacherMapper.insertSelective(record);
    }

    @Override
    public List<Teacher> selectByExample(TeacherExample example) {
        return teacherMapper.selectByExample(example);
    }

    @Override
    public Teacher selectByPrimaryKey(Integer teacherId) {
        return teacherMapper.selectByPrimaryKey(teacherId);
    }

    @Override
    public int updateByExampleSelective(Teacher record,TeacherExample example) {
        return teacherMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(Teacher record,TeacherExample example) {
        return teacherMapper.updateByExample(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(Teacher record) {
        return teacherMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Teacher record) {
        return teacherMapper.updateByPrimaryKey(record);
    }

}
